<HTML>
<HEAD>
	<TITLE>JavaScript Toolbox - Dynamic Option List</TITLE>
<SCRIPT LANGUAGE="JavaScript">

function ajaxRequest(){
 var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
 if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
  for (var i=0; i<activexmodes.length; i++){
   try{
    return new ActiveXObject(activexmodes[i]);
   }
   catch(e){
    //suppress error
   }
  }
 }
 else if (window.XMLHttpRequest) // if Mozilla, Safari etc
  return new XMLHttpRequest();
 else
  return false;
}
function ajaxfunc(){
var mypostrequest=new ajaxRequest();
mypostrequest.onreadystatechange=function(){
 if (mypostrequest.readyState==4){
  if (mypostrequest.status==200 || window.location.href.indexOf("http")==-1){
   document.getElementById("result").innerHTML=mypostrequest.responseText;
  }
  else{
   alert("An error has occured making the request");
  }
 }
}
var namevalue=document.getElementById("nm").value;
var agevalue=document.getElementById("age").value;
var testvalue=document.getElementById("test").value;
//var parameters="?name="+namevalue+"&age="+agevalue;
var parameters="name="+namevalue+"&age="+agevalue+"&test="+testvalue;
mypostrequest.open("POST", "myform.php", true);
mypostrequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
mypostrequest.send(parameters);
}
</SCRIPT>
</HEAD>
<BODY>

<form>
Your name: <input type="text" id="nm" name="nm" size="25" /> <br />
Your age: <input type="text" id="age" name="age" size="25" /> <br />
Your test: <input type="text" id="test" name="test" size="25" /> <br />
<input type="button" value="submit" onClick="ajaxfunc()" />
</form>

<div id="result"> </div>



</BODY>
</HTML>
